﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Service
{
    public class MyX509Validator : System.IdentityModel.Selectors.X509CertificateValidator
    {
        public override void Validate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
        {
            if (certificate == null)
            {
                throw new ArgumentNullException("X509认证证书为空！");
            }

            string str = certificate.Thumbprint.Trim().ToUpper();
            string str2 = "‎‎96 89 0e 60 0a 77 99 35 3c 82 22 66 5b b3 36 aa 4e ea d9 bb".Replace(" ", "").ToUpper();

            //if ("‎e1c06ee70c5ee0b0b56e3a08036c0c81928f854e".ToUpper().CompareTo(str) != 0)
            if (str2.CompareTo(str) != 0)
            {
                throw new System.IdentityModel.Tokens.SecurityTokenException("Certificate Validation Error!");
            }
        }
    }

    public class A
    {
        
    }

}